// @ts-nocheck
const types = {
  input: "input",         //输入
  select: "select",       //选择
}

// 入组统计 统计方式
const chartMode = {
  heap: "heap",           //堆积
  auratus: "auratus",     //簇状
}


//页面状态
const PageType = {
  create: "create", //新建
  edit: "edit",     //编辑
  view: "view",   //查看
  createText: "新建",
  editText: "编辑",
  viewText: "查看"
}

//项目类型状态
const ProjectType = {
  label: 1,    //标注
  audit: 2,   //审核
  alg: 3,     //算法
  1: '标注',
  2: '审核',
  3: '算法',
}


//项目状态
const ProjectStatus = {
  off: 0,
  on: 2,
  stop: 5,
  offText: "未启用",
  onText: "启用",
  stopText: "停用"
}


const taskStatus = {
  off: 0,     // 未发布
  way: 1,     // 进行中
  finish: 2,  // 已完成
  end: 3,     // 已终结
}

const TEXT = "Text";
/**
 *  changeEnumValue(1, ProjectStatus);          //未启用
 *  changeEnumValue("未启用", ProjectStatus);   //1
 */
function toggleEnumValue(initValue, config) {
  if( initValue == undefined ) return "";
  let value = "";
  Object.keys(config).forEach(key => {
    if (config[key] === initValue) {
      const _key = key.split(TEXT)[0];
      const _value = key.indexOf(TEXT) === -1 ? config[key + TEXT] : config[_key];
      value = _value;
    }
  })
  if( value === "" ){
    console.warn("toggleEnumValue函数返回值为'', 请检查")
  }
  return value;
}



//新建项目步骤
const Step = {
  projectConfig: "projectConfig",         //项目信息
  addData: "addData",                     //添加数据
  labelStaff: "labelStaff",               //标注人员
  created: "created",                     //创建完成

  
}
//控件类型
const ControlTypes = {
   'text': '文本框', 
   'select': '下拉框', 
   'radiobox': '单选框', 
   'checkbox': '复选框', 
   'child_select': '二级下拉菜单'
}

//性别
const Gender = {
  "M": "男",
  "male":  "男",
  "F": "女",
  "female": "女",
}




export {
  toggleEnumValue,
  types,
  chartMode,
  ProjectStatus,
  PageType,
  ProjectType,
  Step,
  ControlTypes,
  Gender,
  taskStatus,
}